package com.xxy.controller;

import com.xxy.entity.vo.ChartLineVO;
import com.xxy.entity.vo.ChartVO;
import com.xxy.result.Result;
import com.xxy.service.DashBoardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dashboard")
public class DashBoardController {
    @Autowired
    private DashBoardService dashBoardService;

    @GetMapping("/statistics")
    public Result<List<ChartVO>> statistics() {
        List<ChartVO> statistics = dashBoardService.statistics();
        return Result.success(statistics);
    }
    @GetMapping("/productTrend")
    public Result<List<ChartLineVO>> getProductTrend() {
        List<ChartLineVO> trend = dashBoardService.getProductTrend();
        return Result.success(trend);
    }
}
